package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.common.dto.MemberRequest;
import com.qf.entity.Member;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;


/**
 * @author KING
 * @ClassName: com.qf.mapper.MemberMapper
 * @Description: 该类的功能描述
 * @date: 2021/10/25 22:06
 */


public interface MemberMapper extends BaseMapper<Member> {

    Member selectMember(@Param("username") String username);

    Integer insertMember(@Param("member") Member member);

    default Boolean updateMember(MemberRequest memberRequest) {
        Member member = new Member();
        BeanUtils.copyProperties(memberRequest, member);
        int update = this.updateById(member);
        return update > 0;
    }
}